-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow selecting field for email recipient without saving first #42
Conversation
937dd44
to
2a2cf60
Compare
Bump. I know the fix looks a bit ugly but it makes a big difference to the UX of adding recipients |
Should this PR be targetting
Just to make sure I'm understanding this correctly - I'm assuming this doesn't work because the It would probably be worth adding a comment to the top of the new method explaining that this is a workaround for that session mismatching - that way if we ever change |
Yep exactly |
2a2cf60
to
ed165db
Compare
I’ve rebased this now and targeted |
Can you please provide step-by-step instructions for reproducing the original problem from a fresh installation? I can't seem to reproduce it with this module in the |
I think to recreate it you need to set: SilverStripe\UserForms\Model\Recipient\EmailRecipient:
allow_unbound_recipient_fields: true If you then create a form that has at least one field with the Email type, then when you add a new email recipient against a (elemental) userform, you’ll see the “Before” screenshot above which includes the message:
To select from the list of email fields defined in the form, you have to enter an email and save it first, then you’ll see the dropdown with a list of fields to choose from. After this change, you’ll see the “After” screenshot where you can immediately select an email address from the list of user defined fields before writing for the first time. |
Can you please provide step by step instructions? I'm unable to get the "before" screenshot even with that configuration. I only ever get "after". Maybe relevant, here's the versions of things I have installed when I can't reproduce the original problem: |
My bad, my framework version was locked to 4.11... turns out another genius has already fixed this in framework 😉 silverstripe/silverstripe-framework#10297 |
When adding a new
EmailRecipient
against a user form, as the record hasn’t been written yet, userforms relies on theLeftAndMain.currentPage
session value to find the form:https://github.com/silverstripe/silverstripe-userforms/blob/b990c9e004e5b13f2afdefd12817f03fa7d5107c/code/Model/Recipient/EmailRecipient.php#L135-L156
That obviously doesn’t work for userform elements, so this is a workaround for that. Currently you have to type in a random email address, save the recipient, and then you can see the dropdown for fields to pick from.
Before:
After: